import urllib.request
import requests

url_1 = 'https://bj.fang.com/quanwangso/search.html?city=bj&refer=sy_seach'
url_2 = 'https://www.guazi.com/bj/buy/'

#urllib
response_urllib = urllib.request.urlopen(url_1)
print('urllib 请求 1:')
print('状态码:', response_urllib.getcode())
print('返回对象属性:', response_urllib.info())
print('返回体:', response_urllib.read())

#requests
response_requests_1 = requests.get(url_1)
print('\nrequests 请求 1:')
print('状态码:', response_requests_1.status_code)
print('返回对象属性:', response_requests_1.headers)
print('返回体:', response_requests_1.text)

response_requests_2 = requests.get(url_2)
print('\nrequests 请求 2:')
print('状态码:', response_requests_2.status_code)
print('返回对象属性:', response_requests_2.headers)
print('返回体:', response_requests_2.text)